#! /bin/sh

if [ ! -n "$1" ]; then
  echo "tag is required!"
  exit
fi

tag=$1
# 默认获取当前文件夹名作为镜像名，可自定义
name=$(basename "$PWD")


echo "current tag: $tag"
echo "current name: $name"

# 本地构建命令具体见当前目录下的package.json
npm run vbuild

docker build -f Dockerfile-local -t $name:$tag .

docker save -o $name-$tag.tar $name:$tag
